<?php
/**
 * YOS News Crawler Component
 *
 * @package		yos_news_crawler
 * @subpackage	Components
 * @link		http://yopensource.com
 * @author		yopensource
 * @copyright 	yopensource (yopensource@gmail.com)
 * @license		Commercial
 */

jimport('joomla.application.component.controller');

/**
 * Translator Component Controller
 *
 * @package		yos_translator
 */
class YOS_NewsController extends JController
{
	/**
	 * Method to display the view
	 *
	 * @access	public
	 */
	function display()
	{		
		$this->linkmanager();
	}
	
	function linkmanager(){
		global $mainframe;		
		
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'list';
		$mName		= 'linkmanager';
		// Get/Create the view
		$view = &$this->getView( 'linkmanager', $vType);
		// Get/Create the model
		
		if ($model = &$this->getModel($mName)) {
			// Push the model into the view (as default)
			$view->setModel($model, true);
		}
		
		// Set the layout
		$view->setLayout($vLayout);
		
		// Display the view		
		$view->display();
	}
	function jobmanager()
	{
		global $mainframe;		
		
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'default';
		$mName		= 'jobmanager';
		// Get/Create the view
		$view = &$this->getView( 'jobmanager', $vType);
		// Get/Create the model
		
		if ($model = &$this->getModel($mName)) {
			// Push the model into the view (as default)
			$view->setModel($model, true);
		}
		
		// Set the layout
		$view->setLayout($vLayout);
		
		// Display the view		
		$view->display();
	}
	function cmsmanager()
	{
		global $mainframe;		
		
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'default';
		$mName		= 'cmsmanager';
		// Get/Create the view
		$view = &$this->getView( 'cmsmanager', $vType);
		// Get/Create the model
		
		if ($model = &$this->getModel($mName)) {
			// Push the model into the view (as default)
			$view->setModel($model, true);
		}
		
		// Set the layout
		$view->setLayout($vLayout);
		
		// Display the view		
		$view->display();
	}
	function linkcheck(){
		global $mainframe;		
		
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'list';
		$mName		= 'linkcheck';
		// Get/Create the view
		$view = &$this->getView( 'linkcheck', $vType);
		// Get/Create the model
		
		if ($model = &$this->getModel($mName)) {
			// Push the model into the view (as default)
			$view->setModel($model, true);
		}
		
		// Set the layout
		$view->setLayout($vLayout);
		
		// Display the view		
		$view->display();
	}
	
	function about(){
		global $mainframe;
		
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'about';
		$mName		= 'version';
		
		// Get/Create the view
		$view = &$this->getView( 'about', $vType);
		
		// Get/Create the model	
		$checkversion	=	&YOS_utility::getVersion();
		$version	=	$checkversion['version'];
		$url		=	$checkversion['url'];
		$pc			=	$checkversion['productcode'];
		if ($model = &$this->getModel($mName,'', array('version'=> $version, 'url'=> $url , 'pc'=> $pc ))) {
			// Push the model into the view (as default)
			$view->setModel($model, true);
		}
				
		// Set the layout
		$view->setLayout($vLayout);
		
		//display view
		$view->display();
	}
	
	function restore(){
		if (JRequest::getCmd('task',null)=='doInstall'){
			JRequest::checkToken() or jexit( 'Invalid Token' );
		}
		$document 	= &JFactory::getDocument();
		$vType		= $document->getType();
		$vLayout 	= 'upload';
		$mName		= 'restore';
		// Get/Create the view
		$view = &$this->getView( 'restore', $vType);
		// Get/Create the model	
		
		$model = &$this->getModel($mName);
		if (JRequest::getCmd('task',null)=='doInstall'){
			if ($model->install()) {
				$cache = &JFactory::getCache('mod_menu');
				$cache->clean();
			}
		}
		$view->setModel($model, true);	
		// Set the layout
		$view->setLayout($vLayout);
		jimport('joomla.client.helper');
		$ftp =& JClientHelper::setCredentialsFromRequest('ftp');
		$view->assignRef('ftp', $ftp);
		// Display the view		
		$view->display();
	}
	
}
?>
